<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="app">
        <h1>{{msg}}</h1>
        <h2>{{obj.name}}</h2>
        <button @click="changemsg">change msg</button>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        let vm = new Vue({
            el:'.app',
            data:{
                msg:'没下课呢！！',
                obj:{
                    name:'tom'
                }
            },
            methods: {
                changemsg(){
                    // this.msg = '下课了！！'
                    // this.$set()
                    // $set只能更改数组或者对象   第二个参数为key  第三个参数 更改后的值
                    this.$set(this.obj,'name','jack');
                }
            },
        })
        Vue.set(vm.obj,'name','cc');
    </script>
</body>
</html>